package com.dtx.practice.two;

/**
 * AB,B
 */
public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer a = new StringBuffer("A");
        StringBuffer b = new StringBuffer("B");
        System.out.println("a:"+System.identityHashCode(a));
        System.out.println("b:"+System.identityHashCode(b));
        operator(a,b);
        System.out.println("a:"+System.identityHashCode(a));
        System.out.println("b:"+System.identityHashCode(b));
        System.out.println(a+","+b);
    }

    public static void operator(StringBuffer x,StringBuffer y){
        System.out.println("x:"+System.identityHashCode(x));
        System.out.println("y:"+System.identityHashCode(y));
        x.append(y);
        y=x;
        System.out.println("x:"+System.identityHashCode(x));
        System.out.println("y:"+System.identityHashCode(y));
    }
}
